import pandas as pd
from skbio.diversity.alpha import shannon, simpson_e, observed_otus

# Script to generate alpha diversity metrics of nasal 16S samples

counts = pd.read_csv('../../data/nasal/otu_table.gt10_rar10K.tsv', sep='\t', index_col=0).transpose()

alpha_div = pd.concat([counts.apply(shannon).rename('shannon_div'),
                       counts.apply(simpson_e).rename('simpson_e_div'),
                       counts.apply(observed_otus).rename('n_otus_div')], axis=1)

alpha_div.to_csv('../../data/nasal/otu_alpha_diversity.csv', index_label='SampleID')
